package com.example.mardan_demo1.controller.com;

import com.example.mardan_demo1.pojo.Result;


import com.example.mardan_demo1.pojo.qx.QxInfo;
import com.example.mardan_demo1.pojo.yp.YpInfo;
import com.example.mardan_demo1.service.YpInfoService;
import org.springframework.aop.IntroductionInterceptor;
import org.springframework.web.bind.annotation.*;

import org.springframework.beans.factory.annotation.Autowired;

/**
* 药品检品登记表(yp_info)表控制层
*
* @author xxxxx
*/
@RestController
@RequestMapping("/yp_info")
public class YpInfoController {
/**
* 服务对象
*/
    @Autowired
    private YpInfoService ypInfoService;


    /**
     * 新增药品-客户
     * ApiDes:
     * @param
     * @return 响应描述：
     */
    @PostMapping("/add-yaopin")
    public Result addYaoPin(YpInfo ypInfo) {
        return Result.success(ypInfoService.insert(ypInfo));
    }
    /**
     * 获取药品列表
     */
    @PostMapping("/list")
    public Result list(String yangPinMingCheng, Integer pageSize, Integer pageNum) {
        return ypInfoService.list(yangPinMingCheng, pageSize, pageNum);
    }
    /**
     * 客户根据药品id获取详情
     */
    @PostMapping("/kh-detailbyid")
    public Result getDetailById(Integer id) {
        return ypInfoService.getDetailById(id);
    }
    /**
     *客户根据药品id编辑自己的药品信息
     */
    @PostMapping("/kh-update-by-id")
    public Result khUpdateById(YpInfo ypInfo) {
        return ypInfoService.khUpdateById(ypInfo);
    }
    /**
     * 管理员查看药品列表
     */
    @PostMapping("/admin-get-yp-list")
    public Result adminGetYpList(String yangPinMingCheng, Integer pageSize, Integer pageNum) {
        return ypInfoService.adminGetYpList(yangPinMingCheng, pageSize, pageNum);
    }
    /**
     * 管理员查看药品详情，根据id
     */
    @PostMapping("/adminGetYaoPinDetailById")
    public Result adminGetYaoPinDetailById(Integer id) {
        return ypInfoService.adminGetYaoPinDetailById(id);
    }
    /**
     *客户根据id删除自己的检品
     */
    @PostMapping("/kehu-delYaoPinById")
    public Result kehuDelYaoPinById(Integer id) {
        return ypInfoService.kehuDelYaoPinById(id);
    }
    /**
     * 客户将暂存的药品提交至受理
     */
    @PostMapping("/kehu-tijiao-yaopin-shouli")
    public Result kehuTiJiaoYaoPin(Integer yaoPinId) {
        return ypInfoService.kehuTiJiaoYaoPin(yaoPinId);
    }
    /**
     * 管理员驳回用户申请
     */
    @PostMapping("/admin-bohui-shouli-qingqiu")
    public Result adminBoHuiShouLi(Integer yaoPinId, String chuLiYiJian) {
        return ypInfoService.adminBoHuiShouLi(yaoPinId, chuLiYiJian);
    }
    /**
     * 管理员接受用户受理请求
     */
    @PostMapping("/admin-jieshou-shouli")
    public Result adminJieshouShouLi(Integer yaoPinId, String jianPinBianHao, String chuLiYiJian) {
        return ypInfoService.adminJieshouShouLi(yaoPinId, jianPinBianHao, chuLiYiJian);
    }
    /**
     * 管理员检验完成-上传报告书
     */
    @PostMapping("/admin-jianyanwancheng-shangchuanfujian")
    public Result adminJianyanWanchengShangChuanFujian(Integer yangPinId, String baoGaoShuFuJian) {
        return ypInfoService.adminJianyanWanchengShangChuanFujian(yangPinId, baoGaoShuFuJian);
    }
    /**
     * 获取药品流程信息-进度-根据yangPinId获取
     */
    @PostMapping("/get-processlogs-byid")
    public Result getProcessLogsById(Integer yangPinId) {
        return ypInfoService.getProcessLogsById(yangPinId);
    }
    /**
     *user-yp-客户撤回提交-讲提交的检品在管理员没有受理之前取消提交
     */
    @PostMapping("/kehu-chexiao-tijiao-caozuo")
    public Result keHuCheXiaoTiJiaoCaoZuo(Integer yangPinId){
        return ypInfoService.keHuCheXiaoTiJiaoCaoZuo(yangPinId);
    }
    /**
     * admin-yp-管理员获取待受理样品数量
     */
    @PostMapping("/admin-get-daiShouLi-shuLiang")
    public Result adminCount(){
        return ypInfoService.adminCount();
    }

    /**
     *user-qx-新增医疗器械
     */
    @PostMapping("/qx-add")
    public Result qxAdd(QxInfo qx) {
        return ypInfoService.qxAdd(qx);
    }
    /**
     *user-qx-根据id更新医疗器械样品信息
     */
    @PostMapping("/qx-update-by-id")
    public Result qxUpdateById(QxInfo qx) {
        return ypInfoService.updateByPrimaryKeySelective(qx);
    }
    /**
     *user-qx-用户获取自己新增的医疗器械列表
     */
    @PostMapping("/qx-getOwnList")
    public Result qxGetOwnList(String yangPinMingCheng,
                               Integer pageSize,
                               Integer pageNum){
        return ypInfoService.qxGetOwnList(yangPinMingCheng, pageSize, pageNum);
    }
    /**
     *user-qx-用户根据id获取器械样品详情
     */
    @PostMapping("/qx-userGetOwnQxInfoByQxId")
    public Result qxUserGetOwnQxInfoByQxId(Integer qxId) {
        return ypInfoService.qxUserGetOwnQxInfoByQxId(qxId);
    }
    /**
     *user-qx-客户讲暂存的器械样品提交
     */
    @PostMapping("/qx-kehu-tijiao")
    public Result qxKehuTiJiao(Integer qxId) {
        return ypInfoService.qxKehuTiJiaoYaoPin(qxId);
    }
    /**
     *user-qx-客户将提交的器械样品撤回
     */
    @PostMapping("/qx-kehu-chehui")
    public Result qxKeHuCheHui(Integer qxId) {
        return  ypInfoService.qxKeHuCheHui(qxId);
    }
    /**
     *user-qx-客户删除自己的器械样品
     */
    @PostMapping("/qx-kehu-shanchu")
    public Result qxKeHuShanChu(Integer qxId) {
        return ypInfoService.qxKeHuShanChu(qxId);
    }
    /**
     *admin-qx-管理员根据id获取样品详情
     */
    @PostMapping("/qx-admin-getdetail")
    public Result adminQxGetDetailById(Integer id) {
        return ypInfoService.adminQxGetDetailById(id);
    }
    /**
     *admin-qx-管理员获取医疗器械列表，不现实用户暂存的
     */
    @PostMapping("/qx-admin-getqxlist")
    public Result adminQxGetList(String yangPinMingCheng, Integer pageNum, Integer pageSize) {
        return ypInfoService.adminQxGetList(yangPinMingCheng, pageNum, pageSize);
    }
    /**
     *admin-qx-管理员驳回用户的申请
     */
    @PostMapping("/qx-admin-bohui-yonghu-qingqiu")
    public Result adminQxBoHuiShouLi(Integer qxId, String chuLiYiJian) {
        return ypInfoService.adminQxBoHuiShouLi(qxId, chuLiYiJian);
    }
    /**
     *admin-qx-管理员同意受理
     */
    @PostMapping("/qx-admin-tongyi-shouli")
    public Result adminQxTongYiShouLi(Integer qxId, String jianPinBianHao, String chuLiYiJian){
        return  ypInfoService.adminQxTongYiShouLi(qxId, jianPinBianHao, chuLiYiJian);
    }
    /**
     *admin-qx-管理员完成检验，上传检验报告
     */
    @PostMapping("/qx-admin-wancheng-jianyan-shangchuan-baogao")
    public Result adminQxJianYanWanCheng(Integer qxId, String baoGaoShuFuJian) {
        return ypInfoService.adminQxJianYanWanCheng(qxId, baoGaoShuFuJian);
    }
    /**
     *admin-qx-管理员根据样品id获取操作日志
     */
    @PostMapping("/qx-admin-get-processById")
    public Result adminQxGetProcessLogsById(Integer qxId){
        return ypInfoService.adminQxGetProcessLogsById(qxId);
    }
    /**
     *user-qx-客户获取自己的器械样品日志
     */
    @PostMapping("/qx-user-get-processById")
    public Result userQxGetProcessLogsById(Integer qxId) {
        return ypInfoService.userQxGetProcessLogsById(qxId);
    }
    /**
     *admin-qx-管理员根据样品id获取医疗器械进度
     */
    @PostMapping("/qx-admin-get-jindu")
    public Result adminQxGetJinDuById(Integer qxId) {
        return ypInfoService.adminQxGetJinDuById(qxId);
    }




























}
